<html>
<head><meta charset="utf-8"><title>Relax ELF relocations · t-compiler/wg-llvm · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/187780-t-compiler/wg-llvm/index.html">t-compiler/wg-llvm</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/187780-t-compiler/wg-llvm/topic/Relax.20ELF.20relocations.html">Relax ELF relocations</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="181834681"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187780-t-compiler/wg-llvm/topic/Relax%20ELF%20relocations/near/181834681" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jethro <a href="https://rust-lang.github.io/zulip_archive/stream/187780-t-compiler/wg-llvm/topic/Relax.20ELF.20relocations.html#181834681">(Nov 25 2019 at 15:52)</a>:</h4>
<p>how would I modify rustc so it configures a particular LLVM target as if you'd run <code>llc -relax-elf-relocations</code> or <code>llvm-mc -relax-relocations</code>?</p>



<a name="181834839"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187780-t-compiler/wg-llvm/topic/Relax%20ELF%20relocations/near/181834839" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jethro <a href="https://rust-lang.github.io/zulip_archive/stream/187780-t-compiler/wg-llvm/topic/Relax.20ELF.20relocations.html#181834839">(Nov 25 2019 at 15:53)</a>:</h4>
<p>problem is I'm trying to use rust-lld, but it treats R_X86_64_GOTPCREL differently from R_X86_64_GOTPCRELX, unlike ld.bfd/ld.gold, which treat it the same</p>



<a name="181834843"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187780-t-compiler/wg-llvm/topic/Relax%20ELF%20relocations/near/181834843" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jethro <a href="https://rust-lang.github.io/zulip_archive/stream/187780-t-compiler/wg-llvm/topic/Relax.20ELF.20relocations.html#181834843">(Nov 25 2019 at 15:53)</a>:</h4>
<p>rustc currently emits R_X86_64_GOTPCREL but I think my problem would be solved if it emitted R_X86_64_GOTPCRELX instead</p>



<a name="181836768"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187780-t-compiler/wg-llvm/topic/Relax%20ELF%20relocations/near/181836768" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jethro <a href="https://rust-lang.github.io/zulip_archive/stream/187780-t-compiler/wg-llvm/topic/Relax.20ELF.20relocations.html#181836768">(Nov 25 2019 at 16:13)</a>:</h4>
<p>I'm trying to use <code>-C llvm-args</code> but I can't seem to do anything useful with that option</p>



<a name="181836989"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187780-t-compiler/wg-llvm/topic/Relax%20ELF%20relocations/near/181836989" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jethro <a href="https://rust-lang.github.io/zulip_archive/stream/187780-t-compiler/wg-llvm/topic/Relax.20ELF.20relocations.html#181836989">(Nov 25 2019 at 16:15)</a>:</h4>
<p>ok I think I can hook in at <code>LLVMRustCreateTargetMachine</code></p>



<a name="181914226"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187780-t-compiler/wg-llvm/topic/Relax%20ELF%20relocations/near/181914226" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mati865 <a href="https://rust-lang.github.io/zulip_archive/stream/187780-t-compiler/wg-llvm/topic/Relax.20ELF.20relocations.html#181914226">(Nov 26 2019 at 12:01)</a>:</h4>
<p>There is config option for it: <a href="https://github.com/rust-lang/rust/blob/0f6f66fcdc4abf110171ee06b1a72bdd2883b74f/src/librustc_target/spec/mod.rs#L609" target="_blank" title="https://github.com/rust-lang/rust/blob/0f6f66fcdc4abf110171ee06b1a72bdd2883b74f/src/librustc_target/spec/mod.rs#L609">https://github.com/rust-lang/rust/blob/0f6f66fcdc4abf110171ee06b1a72bdd2883b74f/src/librustc_target/spec/mod.rs#L609</a><br>
You can change in in the target spec file (<code>/src/librustc_target/spec/${TARGET}</code>).</p>



<a name="181914648"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187780-t-compiler/wg-llvm/topic/Relax%20ELF%20relocations/near/181914648" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> mati865 <a href="https://rust-lang.github.io/zulip_archive/stream/187780-t-compiler/wg-llvm/topic/Relax.20ELF.20relocations.html#181914648">(Nov 26 2019 at 12:07)</a>:</h4>
<p>Sorry I misread it.<br>
You could add another option to that file. I don't know if it requires additional changes in rustllvm though.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>